00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _graph_partioner_implementation_hpp_
00021 #define _graph_partioner_implementation_hpp_
00022
00023 #include <gridpack/partition/adjacency_list.hpp>
00024
00025 namespace gridpack {
00026 namespace network {
00027
00028
00029
00030
00031 class GraphPartitionerImplementation
00032 : public parallel::Distributed,
00033 private utility::Uncopyable
00034 {
00035 public:
00036
00037
00038 typedef AdjacencyList::Index Index;
00039
00040
00041 typedef AdjacencyList::IndexVector IndexVector;
00042
00043
00044 typedef std::vector<IndexVector> MultiIndexVector;
00045
00046
00047 GraphPartitionerImplementation(const parallel::Communicator& comm);
00048
00049
00050 GraphPartitionerImplementation(const parallel::Communicator& comm,
00051 const int& local_nodes, const int& local_edges);
00052
00053
00054 virtual ~GraphPartitionerImplementation(void);
00055
00056
00057 void add_node(const Index& global_index, const Index& original_index)
00058 {
00059 p_adjacency_list.add_node(global_index, original_index);
00060 }
00061
00062
00063
00064 void add_edge(const Index& edge_index,
00065 const Index& node_index_1,
00066 const Index& node_index_2)
00067 {
00068 p_adjacency_list.add_edge(edge_index, node_index_1, node_index_2);
00069 }
00070
00071
00072 void get_global_edge_ids(int idx, Index *node_index_1, Index *node_index_2) const
00073 {
00074 p_adjacency_list.get_global_edge_ids(idx, node_index_1, node_index_2);
00075 }
00076
00077
00078 size_t nodes(void) const
00079 {
00080 return p_adjacency_list.nodes();
00081 }
00082
00083
00084 Index node_index(const int& local_index) const
00085 {
00086 return p_adjacency_list.node_index(local_index);
00087 }
00088
00089
00090 size_t edges(void) const
00091 {
00092 return p_adjacency_list.edges();
00093 }
00094
00095
00096 Index edge_index(const int& local_index) const
00097 {
00098 return p_adjacency_list.edge_index(local_index);
00099 }
00100
00101
00102 void partition(void);
00103
00104
00105 void node_destinations(IndexVector& dest) const;
00106
00107
00108 void edge_destinations(IndexVector& dest) const;
00109
00110
00111 void ghost_node_destinations(MultiIndexVector& dest) const;
00112
00113
00114 void ghost_edge_destinations(IndexVector& dest) const;
00115
00116 protected:
00117
00118
00119 AdjacencyList p_adjacency_list;
00120
00121
00122 IndexVector p_node_destinations;
00123
00124
00125 IndexVector p_edge_destinations;
00126
00127
00128 MultiIndexVector p_ghost_node_destinations;
00129
00130
00131 IndexVector p_ghost_edge_destinations;
00132
00133
00134 virtual void p_partition(void) = 0;
00135
00136 };
00137
00138
00139 }
00140 }
00141
00142
00143 #endif